<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBasicInfoChangesTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('basic_info_changes', function (Blueprint $table) {
//            $table->comment('基础信息编辑审核记录表');
            $table->bigIncrements('id')->comment('ID');
            $table->boolean('tab_id')->default(false)->comment('选项卡id');
            $table->integer('user_id')->default(0)->comment('用户id');
            $table->boolean('type')->comment('操作类型：1-新增，2-更新');
            $table->boolean('data_type')->default(true)->comment('数据类型：1-文本，2-老字典数据id，3-时间');
            $table->string('origin_value', 255)->default('')->comment('原始值');
            $table->string('change_value', 255)->default('')->comment('修改值');
            $table->string('update_value', 255)->default('')->comment('更新值');
            $table->boolean('status')->default(false)->comment('状态：0-初始，1-审核通过，2-驳回，3-直接修改通过');
            $table->text('reason')->nullable()->comment('审核原因');
            $table->string('field', 32)->default('')->comment('修改字段数据表中键');
            $table->string('field_name', 255)->default('')->comment('修改所属名称');
            $table->dateTime('created_at')->nullable()->comment('创建时间');
            $table->dateTime('updated_at')->nullable()->comment('更新时间');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('basic_info_changes');
    }
};
